package com.lcxw.hxzbadmin.dao.configmapper;

import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import com.lcxw.hxzbadmin.entity.configbean.ServerConfig;

@Mapper
@Component
public interface ServerConfigMapper {

    @Delete({
        "delete from ywpd_server",
        "where `id` = #{id}"
    })
    int deleteByPrimaryKey(Integer id)throws Exception;

    @Insert({
        "insert into ywpd_server (`name`, `ip`, ",
        "`isDefault`, `status`, `addTime`)",
        "values (#{name}, #{ip}, ",
        "#{isDefault}, #{status}, #{addTime})"
    })
    int insert(ServerConfig record)throws Exception;

    @Select({
        "select",
        "`id`, `name`, `ip`, `isDefault`, `status`, `addTime`",
        "from ywpd_server",
        "where `id` = #{id,jdbcType=INTEGER}"
    })
    ServerConfig selectByPrimaryKey(Integer id)throws Exception;

    @Select("select * from ywpd_server")
    List<ServerConfig> selectAll()throws Exception;

    @Update({
        "update ywpd_server",
        "set `name` = #{name},",
        "`ip` = #{ip},",
        "`isDefault` = #{isDefault},",
        "`status` = #{status},",
        "`addTime` = #{addTime}",
        "where `id` = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(ServerConfig record)throws Exception;

}
